<template>
  <div class="box">
    <div class="data">12月8日 周二</div>
    <div class="picture"  @click="toFilmDetail(film.filmId)">
      <!-- v-lazy 为指令，指令中属性值为js环境 -->
      <img v-lazy="film.poster" alt="" />
    </div>
    <div class="content-wapper">
      <div class="title">
        <div class="title-l">{{ film.name }}</div>
      </div>
      <div class="score">
        <div class="score-l">2020</div>
        <div class="score-r">人想看</div>
      </div>
      <div class="actor">{{ film.actors | actorToStr }}</div>
      <div class="show">2020-12-24上映</div>
    </div>
    <div class="buy">预售</div>
  </div>
</template>

<script>
import axios from "axios";
// import Vue from 'vue'
// import VueLazyload from 'vue-lazyload'
// Vue.use(VueLazyload, {
//     loading: "https://2url.cc/1OwrB",
//     error:"https://2url.cc/1OwrB",
// });
export default {
  data() {
    return {
      src:
        "https://p0.meituan.net/movie/d4a8badbe746c7c8c758a0b025864ffc1164336.jpg@1l_1e_1c_128w_180h",
    };
  },
  props: {
    film: Object,
  },
  //   created(){
  //       //发起网络请求
  //       const url =
  //       "https://api.iynn.cn/film/api/v1/getComingSoonFilmList?cors=T&cityId=320900&pageNum=1&pageSize=10"
  //       //发起get请求
  //       axios.get(url).then((res) => console.log(res))
  //   },
  mounted() {},
  methods: {
    toFilmDetail(id) {
      this.$router.push({
        name: "filmDetail",
        params: { id },
      });
    },
  },
};
</script>


<style lang='scss' scoped>
.box {
  width: 100%;
  height: 144px;
  //   background: pink;
  border-bottom: 1px solid #ccc;
  position: relative;
  .data {
    width: 100%;
    height: 30px;
    float: none;
    font-size: 14px;
    color: #333;
    line-height: 30px;
    padding-left: 10px;
  }
  .picture {
    width: 64px;
    height: 90px;
    // background: yellow;
    float: left;
    margin: 10px 0 0 10px;
    img {
      width: 100%;
      height: 100%;
    }
  }
  .content-wapper {
    width: 207px;
    height: 88px;
    margin: 10px 0 0 10px;
    float: left;
    .title {
      width: 207px;
      height: 24px;
      margin-bottom: 6px;
      line-height: 24px;
      overflow: hidden;
      .title-l {
        font-size: 17px;
        color: #333;
        font-weight: 700;
        padding-right: 5px;
        flex-shrink: 1;
      }
    }
    .score {
      width: 207px;
      height: 15px;
      line-height: 15px;
      margin-bottom: 3px;
      .score-l {
        font-weight: 700;
        color: #faaf00;
        font-size: 15px;

        float: left;
      }
      .score-r {
        font-size: 13px;
        color: #666;
        float: left;
        padding-left: 5px;
      }
    }
    .actor {
      width: 207px;
      font-size: 13px;
      color: #666;
      height: 15px;
      line-height: 15px;
      text-overflow: ellipsis;
      overflow: hidden;
      white-space: nowrap;
      margin-bottom: 3px;
    }
    .show {
      width: 207px;
      font-size: 13px;
      color: #666;
    }
  }
  .buy {
    width: 47px;
    height: 27px;
    line-height: 28px;
    text-align: center;
    background-color: #3c9fe6;
    color: #fff;
    border-radius: 4px;
    white-space: nowrap;
    font-size: 12px;
    cursor: pointer;
    position: absolute;
    top: 45px;
    right: 15px;
  }
  &:last-child {
    padding-bottom: 50px;
  }
}
</style>

